{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5625726\n",
      "4632410\n"
     ]
    }
   ],
   "source": [
    "def read_bed(bisulfite_bed):\n",
    "    key_sep = \"||\"\n",
    "    freqinfo = {}\n",
    "    pos_num=0\n",
    "    neg_num=0\n",
    "    with open(bisulfite_bed, \"r\") as rf:\n",
    "        for line in rf:\n",
    "            words = line.strip().split()\n",
    "            if int(words[9])<5:\n",
    "                continue\n",
    "            m_key = key_sep.join([words[0], words[1]])\n",
    "            freqinfo[m_key] = float(words[10])\n",
    "            if int(words[10])>=100:\n",
    "                pos_num+=1\n",
    "            elif int(words[10])<=0:\n",
    "                neg_num+=1\n",
    "    print(pos_num)\n",
    "    print(neg_num)\n",
    "    return freqinfo\n",
    "\n",
    "freqinfo=read_bed('/home/xiaoyifu/data/HG002/Bisulfite/004_0111_001_R1_val_1_bismark_bt2_pe.deduplicated.bedGraph.gz.bismark.zero.cov.bed')\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "deepsignalpenv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
